package s4
// TODO 70.Kotlin语言的定义类与field关键字学习
class KtBase70{
    var name="zouxin";
    /* 背后做的事情：

     @NotNull
     private String name = "Derry";

     public void setName( @NotNull String name) {
          this.name = name;
     }

     @NotNull
     public String getName() {
          return this.name;
     }

   */
    var value = "ABCDEFG"
        // 下面的隐式代码，不写也有，就是下面这个样子
        get() = field
        set(value) {
            field = value
        }

    var info = "abcdefg ok is success"
        get() = field.capitalize() // 把首字母修改成大写
        set(value) {
            field = "**【$value】**"
        }
}

fun main() {
    KtBase70().name="邹欣"
    val ktBase70 = KtBase70()
    println(KtBase70().name)
    println(KtBase70().info)
    ktBase70.info="ssss"
    println(ktBase70.info)

    ktBase70.name="邹欣"
    println(ktBase70.name)
}